1. Field of the Invention
The present invention relates to an image processing device and image processing program, and specifically relates to an image processing device for performing specific image processing of specific regions within an image and processing of regions outside the specific regions.
2. Description of the Related Art
Image processing devices have been proposed which perform specific image processing of specific regions within an image and processing of regions outside the specific regions. Such image processing pertains to image processing called trimming wherein the image belonging to a specific region remains after the image belonging to regions other than the specific region are erased, or, conversely, image processing called masking wherein the image belonging to a specific region is erased and the image of other regions outside the specific region remain.
An image processing device having such a trimming function is disclosed, for example, in Japanese Laid-Open Patent Application No. S62-159570, describing an image processing device which reads a document image of a newspaper or the like together with a desired region within the document image which has been marked by a circumscribing mark made by a felt pen beforehand using an image reading means, recognizes the circumscribing mark by a circumscribing mark recognizing means, and erases the image belonging to the exterior side of the circumscribing mark.
Japanese Laid-Open Patent Application Nos. H5-328096 and H5-153371 disclose image processing devices which perform a trimming process wherein an image within a specified region is formed by moving and rearranging the image within the specified region and trimming unnecessary parts.
In the case of the former device, however, the specifying operation is troublesome inasmuch as the contour of a desired region must be accurately marked when applying the circumscribing mark using a felt pen or the like because the trimming operation is performed in faithful accordance with the circumscribing mark.
In the case of the latter devices, although forming of the image within a specified region is considered, the image outside the specified region is erased unconditionally. For this reason great accuracy in specifying the desired region is required, and the specifying operation is troublesome.
A object of the present invention is to provide an improved image processing device and image processing program which eliminate the aforesaid disadvantages.
Another object of the present invention is to provide an image processing device and image processing program capable of accurately determining a user-desired region even when a region has been only roughly specified.
These objects are attained by providing an image processing device comprising:
a detector for detecting a specific region within an image to be processed;
an image allocator for allocating the image to be processed into a plurality of blocks;
a text recognizing unit for recognizing text included in the image to be processed;
a first determining unit for, on the basis of a recognition result of the text recognizing unit, determining presence and absence of relevance between a first block which is partially included in the specific region and a second block which is entirely included in the specific region among a plurality of blocks allocated by the image allocator; and
a second determining unit for determining whether or not an image of the first block should be treated as an image belonging to the specific region in accordance with a determination result of the first determining unit.
This image processing device may be provided with an image processor for performing specific image processing on the specific region or regions outside the specified region based on a determination result of the second determining unit. This specific image processing may be, for example, erasure of the image.
In this image processing device, the first determining unit, more specifically, determines whether or not a context is appropriate between an article comprised of text belonging to the first block and an article comprised of text belonging to the second block, and determines there is relevance between the first block and the second block when the context is appropriate. Even more specifically, the first determining means has a dictionary recording a plurality of words and phrases, and determines the context is appropriate when a word or phrase straddling across a final or leading text line belonging to the first block and a leading or final text line belonging to the second block matches any words and phrases recorded in the dictionary.
In this image processing device the second determining unit determines that the image of the first block should be treated as the image belonging to the specific region when the first determining unit has determined there is relevance between the first block and the second block.
In this image processing device it is desirable that the image allocator allocates the image to be processed based on lines or white spaces within the image to be processed.
In this image processing device the detector may detect a closed region circumscribed by a line of specific color within the image to be processed as the specific region.
This image processing device also may be provided with an image reader for reading a document image to obtain data of the image to be processed.